$(function() {
	$('#registerDialog').on(
			'hidden.bs.modal',
			function() {
				// 清空input数据
				window.frames['register'].$('#registerForm').resetForm();
				// 清空判断状态
				window.frames['register'].$('#registerForm').data(
						'bootstrapValidator').resetForm();
			});

	$('#login').click(function() {
		$('#loginForm').ajaxSubmit({
			url : ctx + "/global/login.do",
			beforeSubmit : function(arr, $form, options) {
			},
			success : function(data) {
				if (data.flag == 1) {
					location.href = ctx + "/" + data.page;
				} else {
					window.top.alert('账号或密码错误');
				}
			}
		});
	});

	$("#name").keydown(function(event) {
		if (event.keyCode == 13)
			$('#login').click();
	});
	$("#password").keydown(function(event) {
		if (event.keyCode == 13)
			$('#login').click();
	});

});